//
//  QSSubmitProcessingCell.m
//  DigitalEconomy_iOS
//
//  Created by Ding on 2020/3/27.
//  Copyright © 2020 DingC. All rights reserved.
//

#import "QSSubmitProcessingCell.h"

@implementation QSSubmitProcessingCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self configSubView];
}

- (void)configSubView{
    self.backgroundColor = [UIColor clearColor];
    self.contentView.layer.cornerRadius = 8;
    self.contentView.layer.masksToBounds = YES;
    self.contentView.backgroundColor = [UIColor QSColorWhiteFFFFFF];
    [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self.mas_leading).offset(kRealValue(10));
        make.trailing.equalTo(self.mas_trailing).offset(kRealValue(-10));
        make.top.equalTo(self.mas_top).offset(kRealValue(10));
        make.bottom.equalTo(self.mas_bottom).offset(kRealValue(0));
    }];
    
    self.feedbackTextView.backgroundColor = [UIColor QSColorWhiteF9F9F9];
    self.feedbackTextView.layer.cornerRadius = 5;
    self.feedbackTextView.delegate = self;
}

- (void)setDetailModel:(QSProblemDetailModel *)detailModel{
    _detailModel = detailModel;
    _dateRightLabel.text = [NSDate dateWithTimestamp:detailModel.sendTime format:@"yyyy-MM-dd HH:mm"];
    _sendPeopleLabel.text = detailModel.sendName;
    if (detailModel.sendInfo.length == 0) {
      _remarkRightLabel.text = @"暂无备注";
    }else{
      _remarkRightLabel.text = detailModel.sendInfo;
    }
//    [self setupAutoHeightWithBottomView:self.remarkRightLabel bottomMargin:20];
}
#pragma mark - UITextField Delegate
-(void)textViewDidEndEditing:(UITextView *)textView{
    if (self.didInputDealRemarkFinishBlock) {
        self.didInputDealRemarkFinishBlock(textView.text);
    }
}

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
    if (text.length == 0) return YES;//允许删除。
    if (textView.text.length >= 160) {
        return NO;
    }else{
        return YES;
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [super touchesEnded:touches withEvent:event];
    [self endEditing:YES];
}

@end
